package com.hsd.whb.converter;

import com.hsd.whb.entity.Meeting;
import com.hsd.whb.entity.MeetingParticipateText;
import com.hsd.whb.entity.Participants;
import com.hsd.whb.enums.MeetingStatusEnum;
import com.hsd.whb.pojo.output.MeetingParticipateTextVO;
import com.hsd.whb.pojo.output.MeetingVO;
import com.hsd.whb.repository.MeetingParticipateTextRepository;
import com.hsd.whb.repository.ParticipantsRepository;
import com.hsd.whb.repository.RecorderRepository;
import com.hsd.whb.service.ParticipantsService;
import com.hsd.whb.utils.BeanUtil;
import com.hsd.whb.utils.EnumUtil;

import java.util.ArrayList;
import java.util.List;

public class MeetingParticipateTextConverter {

    public static MeetingParticipateTextVO convertToMeetingParticipateTextVO(MeetingParticipateText meetingParticipateText, ParticipantsService participantsService) {
        MeetingParticipateTextVO meetingParticipateTextVO = new MeetingParticipateTextVO();
        BeanUtil.copyProperties(meetingParticipateText, meetingParticipateTextVO);
        Participants participants = participantsService.findParticipantsById(meetingParticipateText.getParticipantsId());
        meetingParticipateTextVO.setParticipantsName(participants.getUsername());
        return meetingParticipateTextVO;
    }

    public static List<MeetingParticipateTextVO> convertToMeetingParticipateTextVOList(List<MeetingParticipateText> meetingParticipateTexts, ParticipantsService participantsService) {
        List<MeetingParticipateTextVO> list = new ArrayList<>();
        for (MeetingParticipateText meetingParticipateText : meetingParticipateTexts) {
            MeetingParticipateTextVO meetingParticipateTextVO = convertToMeetingParticipateTextVO(meetingParticipateText, participantsService);
            list.add(meetingParticipateTextVO);
        }
        return list;
    }

}
